{{> header}}
<div class="banner">It will the same request 5 times to different processes, they will hit the same cache.</div>
<div>
  <button id="btnRequest">Start request</button>
</div>
<div id="dashboard"></div>

<script>
  const requestTimes = 10;
  on('#btnRequest', 'click', async () => {
    dashboard.innerHTML = '';
    btnRequest.setAttribute('disabled', 'disabled');
    try {
      for (let i = 0; i < requestTimes; i++) {
        const res = await alovaInstance.Get('/api/psc', {
          cacheFor: null
        });
        const divEl = document.createElement('div');
        divEl.innerHTML = JSON.stringify(res);
        dashboard.appendChild(divEl);
        await new Promise(resolve => setTimeout(resolve, 1000));
      }
    } finally {
      btnRequest.removeAttribute('disabled');
    }
  });
</script>
